/**	@file Add.h
 *      @brief Representation of additions. */
#ifndef Add_majdo_
#define Add_majdo_
#include <vector>
#include <list>
#include <deque>
#include "Ex.h"
namespace sympycpp{
class Sym;
class Number;

/**	@class Add 
 *      @brief This class is representation of the addition.
 *      Add represents the sum of several (two or more) expressions, because the addition is commutative binary operation. */
class Add : public Ex {
private:
	///	@brief Dynamic structure to storing addends.
	basic_container args_;
	/**	@brief Constructor that exploits the input memory.
         *      The addends of constructed expression are stored in v and it is assumed that are sorted.
         *      The constructor exploits all memory from input parameters that are reset.
	 *      @see allocationPolicy : mark of the special memory management
	 *      @see containerSort : sorting of the conatiner          
	 *	@warning	Elements of v have to be sorted by conatinerSort for the addition.
	 *	@warning 	The elements of v are reset*/
	Add(basic_container & v, const allocationPolicy flag);
public:
	///	@brief Standard copy constructor.
	Add(const Add &);
	virtual ~Add();
	/**	@brief Omitting of an addend at a particular position.
	 * 	@warning If the number of the addneds is two then omiting  will be aborted.
	 * 	@warning The addend that is marked for omitting will be deleted (memory will be released). 
	 * 	@retval true == omitting is successfull
	 * 	@retval false ==   omitting is aborted (probably there are only two addends) */
	bool omit(iterator & index);
	/**	@brief Does the sum (addition) contain more than one multiple expression (addends)? */ 
	bool moreThan1Multiple() const;
	virtual std::string treeView(const int i) const;
	Sign sign() const {
		return ((Ex *)this)->sign();
	}
	virtual void sign(const Sign);
	virtual size_t rsize(const bool all = true) const ;
	virtual size_t asize() const;
	virtual size_t size() const;
	virtual std::string str() const;
	virtual std::string unsigned_str() const;
	virtual Ex * diff(const Sym &) const;
	virtual Ex * copy() const;
	friend class Operations;
	friend class Substitution;
	friend class ComparerIx;
	friend class Utilities;
};
}
#endif
